﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.Todo.Dto;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.Todo
{
    [Authorize]
    [ApiController]
    [Route("api/todo")]
    public class TodoController : BPMReportPlatformController
    {
        private readonly ITodoService _todoService;

        public TodoController(ITodoService todoService)
        {
            _todoService = todoService;
        }

        /// <summary>
        ///代办 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("todo/GetAllAsync")]
        public async Task<PagedResultDto<ItemsItem>> GetAllAsync([FromBody] GetTodoInput input)
        {
            return await _todoService.GetAllAsync(input);
        }

        /// <summary>
        /// 置顶待办
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("todo/top-todo")]
        public async Task<BaseTodoReturnDto> TopTodo([FromBody] params TopTodoDto[] input)
        {
            return await _todoService.TopTodo(input);
        }

        /// <summary>
        /// 消除代办
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("todo/eliminate-todo")]
        public async Task<BaseTodoReturnDto> EliminateTodo([FromBody] params EliminateTodoDto[] input)
        {
            return await _todoService.EliminateTodo(input);
        }
    }
}